<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    //    function Fn1 () {
    //      console.log('this', this)
    //      this.a = 10
    //      this.b = 20
    //     //  this.say = function () {
    //     //    console.log('say-fn1-inner', this)
    //     //  }
    //    }
    // 不加this
    function Fn1 (username, age) {
         console.log('this', this)
        //  let username = 'zhangsan'
        //  let age = 18
         this.username = username
         this.age = age
       }
       Fn1.prototype.say = function () {
           console.log('say-fn1-inner', `'姓名：${this.username},年龄：${this.age}`)
         }
         
       let tp1 = new Fn1('zhangsan', 18) // zhangsan  18
       let tp2 = new Fn1('lisi', 20) // lisi 20
       console.log('==tp1.say是否等于tp2.say==', tp1.say === tp2.say) // true or false
       Fn1()
       let p1 = new Fn1(11,12)
       p1.say()
    //    ---------class---------------------
       class Fn2 {
          a = 10
          b = 20
          say () {
            console.log('say-class-inner', this)
          }
       }
       
    let p2 = new Fn2()
    p2.say()
    
    
       
    </script>
</body>
</html>